/*
 * Copyright 2011 Mark Davidson.
 *
 * Licensed under the Apache License, Version 2.0 (the "License"); you may not
 * use this file except in compliance with the License. You may obtain a copy of
 * the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
 * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
 * License for the specific language governing permissions and limitations under
 * the License.
 */

package org.dctmcommons;

import com.documentum.fc.client.IDfSession;
import com.documentum.fc.common.DfException;

/**
 * Type-related helper methods.
 */
public interface ITypeHelper {

	/**
	 * Gets a list of descendant types for the specified type.
	 * @param session The repository session
	 * @param type The root type
	 * @param includeSelf Whether to include the target type in the results
	 * @return The list of descendant types
	 * @throws DfException The repository exception
	 */
	public String[] getDescendantTypes(IDfSession session,
									   String type,
									   boolean includeSelf) throws DfException;

	/**
	 * Checks if a type is descended from another type.
	 * @param session The session
	 * @param parentType The parent type
	 * @param childType the child type
	 * @return The outcome (true = yes, is descendant)
	 * @throws DfException The repository exception
	 */
	public boolean isDescendantType(IDfSession session,
									String parentType,
									String childType) throws DfException;

	/**
	 * Gets a list of ancestor types for the specified type.
	 * @param session The repository session
	 * @param type The root type
	 * @param includeSelf Whether to include the target type in the results
	 * @return The list of ancestor types
	 * @throws DfException The repository exception
	 */
	public String[] getAncestorTypes(IDfSession session,
									 String type,
									 boolean includeSelf) throws DfException;

	/**
	 * Gets a list of types that are related to the specified type.
	 * @param session The repository session
	 * @param type The root type
	 * @param descendantTypes Whether to get descendant types (otherwise get
	 * ancestor types)
	 * @param includeSelf Whether to include the target type in the results
	 * @return The list of related types
	 * @throws DfException The repository exception
	 */
	public String[] getRelatedTypes(IDfSession session,
									String type,
									boolean descendantTypes,
									boolean includeSelf) throws DfException;

}